home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / tex / lametex_.z / lametex_ / lametex / page / icons.ps < prev    next >
Encoding:
Text File  |  1992-09-02  |  4.8 KB  |  224 lines

  1. % This PostScript file defines a few simple operators for throwing 
  2. % icons onto the page.
  3.  
  4. %% All icons are expected to fit into a 1"x1" square, but they don't have to.
  5.  
  6. %%%%%%%%%%%  icon-name  OutsideTopIcon   - %%%%%%%%%%%%
  7. % Given the name of an icon, executes the icon in the top outside corner.
  8. /OutsideTopIcon
  9. {
  10. } bind def
  11.  
  12. %%%%%%%%%%%  icon-name  LeftMarginIcon   - %%%%%%%%%%%%
  13. % Given the name of an icon, executes the icon in the left margin.
  14. /LeftMarginIcon
  15. {
  16.   gsave
  17.        bslot 72 sub ypos 72 sub translate cvx exec
  18.   grestore
  19. } bind def
  20.  
  21. %%%%%%%%%%%%  icon-name  number SprinkleIcon   - %%%%%%%%%%%%
  22. % Given the name of an icon, executes the icon in the left margin.
  23. /SprinkleIcon
  24. {
  25.   dup 0 eq
  26.   {
  27.      pop
  28.   }
  29.   {
  30.     0 1 3 -1 roll Random
  31.     {
  32.        pop
  33.         gsave
  34.         8.5 in Random 11 in Random translate 0 0 moveto dup cvx exec
  35.         grestore
  36.      } for
  37.      pop
  38.   } ifelse
  39. } bind def
  40.  
  41. /BIG 1073741824 def
  42.  
  43. % Gives a random number between 0 and N
  44. %   N   Random  random-number
  45. /Random
  46. {
  47.    rand BIG div mul 2 div
  48. } bind def 
  49.  
  50. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  51. %% THE FOLLOWING ROUTINES ARE USED IN THE ROACH ICON
  52. %%%%%%%%%%%%%%%%%%%%  - Roach - %%%%%%%%%%%%%%%%%%%%
  53.  
  54. /Body
  55. {
  56.   -1 0 moveto -5 2 lineto -11 15 -9 25 -10 40 curveto
  57.   -1 30 lineto closepath fill
  58. } bind def
  59.  
  60. /Legs
  61. {
  62.   -15 0 moveto  -8 5 lineto -7 10 lineto stroke
  63.   -16 25 moveto -13 20 lineto -7 17 lineto stroke
  64.   -21 40 moveto -15 30 lineto -10 30 lineto -7 25 lineto stroke
  65. } bind def
  66.  
  67. /Head
  68. {
  69.   0 31 moveto 0 31 15 90 135 arc fill
  70.   0 42 moveto 0 42 8 90 200 arc fill
  71.   0 50 moveto 0 50 3 90 200 arc fill
  72.   -4 45 moveto -7 65 lineto stroke
  73. } bind def
  74.  
  75. /Roach
  76. {
  77.   newpath
  78.   gsave
  79.     0.7 setgray
  80.     30 30 translate
  81.     .7 .7 scale
  82.     360 Random rotate
  83.     Body Legs Head
  84.     -1 1 scale
  85.     Body Legs Head
  86.   grestore
  87. } bind def
  88.  
  89.  
  90. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  91. %% END OF ROUTINES FOR THE ROACH ICON
  92. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  93.  
  94. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  95. %% THE FOLLOWING ROUTINES ARE USED IN THE WIZARD ICON
  96. %%%%%%%%%%%%%%%% -  Wizard - %%%%%%%%%%%%%%%%%%
  97.  
  98. /Hat
  99. {
  100.     gsave
  101.     25 54 moveto
  102.     35 51 lineto
  103.     35 Random
  104.     15 add /x exch def    % Hat tilt randomness
  105.     x 5 add 68 x 70 3 arcto pop pop pop pop
  106.     x 5 sub 68 x 2 sub 65 2 arcto pop pop pop pop
  107.     x 2 add 66 lineto 
  108.     closepath
  109.     1 setlinejoin
  110.     gsave dup setgray fill grestore gsave stroke grestore
  111.     % Add the while circles
  112.     clip
  113.     .7 gt { 0 } { 1 } ifelse setgray
  114.     newpath
  115.     0 1 20
  116.     {
  117.       pop 40 Random 20 add 20 Random 50 add 1.5 0 360 arc fill
  118.     } for
  119.     grestore
  120. } bind def
  121.  
  122. % Takes two angles for the arms.
  123. /Clothes
  124. {
  125.     gsave
  126.     1 setlinejoin
  127.     % Robes
  128.     25 30 moveto
  129.     25 20 20 10 17 3 curveto
  130.     30 0 40 5 50 2 curveto
  131.     38 25 34 32 36 35 curveto
  132.  
  133.     % Right arm
  134.     40 Random 10 add            % Right arm randomness
  135.     50 exch lineto 5 15 rlineto
  136.     currentpoint 5 70 -110 arcn
  137.     10 20 rlineto -10 -18 rlineto
  138.     40 43 lineto
  139.     26 43 lineto
  140.     22 42 lineto
  141.  
  142.     % Left arm
  143.     45 Random 20 add dup dup   % Left arm randomness
  144.     10 exch lineto 15 sub 10 exch lineto
  145.     10 exch lineto
  146.     -5 1 -6 -10 0 -10 rcurveto
  147.     0 -5 rlineto
  148.     closepath
  149.     % Add the while circles
  150.     gsave dup setgray fill grestore gsave stroke grestore clip
  151.     .7 gt { 0 } { 1 } ifelse setgray
  152.     newpath
  153.     0 1 50
  154.     {
  155.       pop 60 Random 10 add 50 Random 1.5 0 360 arc fill
  156.     } for
  157.     grestore
  158. } bind def
  159.  
  160. /Face
  161. {
  162.    gsave
  163.       % setgray
  164.       1 setgray
  165.       25 54 moveto 25 33 37 33 35 52 curveto fill
  166.       % currentgray .7 gt { 0 } { 1 } ifelse setgray
  167.       0 setgray
  168.       25 54 moveto 25 33 37 33 35 52 curveto stroke
  169.          newpath .3 setlinewidth
  170.          28 49 1 0 360 arc stroke
  171.          32 48 1 0 360 arc stroke
  172.          30 45 1 0 360 arc fill
  173.  
  174.       % Whiskers
  175.       .7 gt { 0 } { 1 } ifelse setgray
  176.       0 1 10
  177.       {
  178.          25 add
  179.          0 1 5
  180.          {
  181.            pop dup 10 Random 36 add
  182.            moveto -3 Random -1 1 -3 Random 0 -5 Random rcurveto stroke
  183.      } for
  184.          pop
  185.       } for
  186.    grestore
  187. } bind def
  188.  
  189. % draws a picture of a wizard in a 1"x1" square
  190. /Wizard
  191. {
  192.   newpath .5 setlinewidth
  193.   1 Random dup Clothes
  194.   Face
  195.   1 Random Hat
  196. } bind def
  197.  
  198. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  199. %% END OF ROUTINES FOR THE WIZARD ICON
  200. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  201.  
  202. /in {72 mul} def
  203.  
  204. /IconDemo
  205. {
  206.   /icon exch def
  207.   1 1 11
  208.   {
  209.     pop
  210.     1 1 8
  211.     {
  212. % Uncomment this line to see the icon boxes.
  213. %      0 0 moveto 72 0 lineto 72 72 lineto 0 72 lineto closepath stroke
  214.       icon cvx exec
  215.       pop 1 in 0 translate
  216.     } for
  217.     -8 in 1 in translate
  218.   } for
  219. } bind def
  220.  
  221. %% To do a demo of one of the icons, uncomment one of these lines.
  222. % /Wizard IconDemo showpage
  223. % /Roach IconDemo showpage
  224.